package com.sunl.mall.ali.mq.autoconfigure;


import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;

/**
 * mq 配置
 * <p>
 * 由spring将 properties 配置文件转化成该bean
 */
@ConfigurationProperties(prefix = MqEnvProperties.MQ_PREFIX)
public class MqEnvProperties {
    public static final String MQ_PREFIX = "mq";

    public static final String MQ_PRODUCERS_PREFIX = "mq.producers";

    public static final String MQ_ORDER_PRODUCERS_PREFIX = "mq.order-producers";

    public static final String MQ_TRANSACTION_PRODUCERS_PREFIX = "mq.transaction-producers";

    static final String BASE_PACKAGES_PROPERTY_NAME = "mq.consumer-scan-base-packages";

    @Getter
    @Setter
    private String topicEnv;

    @Getter
    @Setter
    private String logRoot;

    @Getter
    @Setter
    private String logLevel;

    @Getter
    private int logMaxIndex = 10;

    /**
     * eg: mq.consumers.xx.xxx
     */
    @Getter
    private Map<String, Properties> consumers = new LinkedHashMap<>(3);

    @Getter
    private Map<String, Properties> producers = new LinkedHashMap<>(3);

    @Getter
    private Map<String, Properties> orderProducers = new LinkedHashMap<>(3);

    @Getter
    private Map<String, TransactionProducerProperties> transactionProducers = new LinkedHashMap<>(3);
}